package com.twu.biblioteca.Models;

import java.util.ArrayList;
import java.util.List;

public class BookCollection
{
    private ArrayList<Book> bookList = new ArrayList<Book>();

    // temporary way to store a sample collection of books. Can be read from a database
    public BookCollection()
    {
       bookList.add(new Book("Book1",false));
       bookList.add(new Book("Book2",false));
       bookList.add(new Book("Book3",false));
    }

    public void addBook(Book book)
    {
        bookList.add(book);
    }

    public List<Book> returnBookList()
    {
        return bookList;
    }

    public List<Book> returnAvailableBookList()
    {
       ArrayList<Book> availableBooks = new ArrayList<Book>();
       for(Book book: bookList)
       {
           if(!book.isReserved())  availableBooks.add(book);
       }
       return availableBooks;
    }
}
